﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using Microsoft.SqlServer.Server;

namespace JeevanVaisya
{
    public partial class LoginDetails : Form
    {
        public LoginDetails()
        {
            InitializeComponent();
        }

        private void LoginDetails_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"].ToString());
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "Select * from LoginDetails where CONVERT(nvarchar(50), LoginTime, 101)='" + DateTime.Now.ToShortDateString() + "'";
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    listBox1.Items.Add(dr["EmpCode"].ToString() + "-" + dr["LoginTime"].ToString());
                }
            }
        }
    }
}
